package com.zzzm.hospital.customerview;

import android.app.AlertDialog;
import android.content.Context;
import android.os.Bundle;
import android.text.TextUtils;
import android.view.View;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.TextView;

import androidx.appcompat.widget.AppCompatButton;

import com.zzzm.hospital.R;

public class AgreementDialog extends AlertDialog {

    private Context context;
    private TextView alertContent;
    private CheckBox alertCheckbox;
    private AppCompatButton alertBtn;

    private String content;
    private OnClickAgreeListener listener;

    public AgreementDialog(Context context) {
        super(context);
        this.context = context;
    }

    public void setListener(OnClickAgreeListener listener) {
        this.listener = listener;
    }

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.aggrement_view);

        initView();
    }

    //初始化界面控件
    private void initView() {
        alertContent = findViewById(R.id.alert_content);
        alertCheckbox = findViewById(R.id.alert_checkbox);
        alertBtn = findViewById(R.id.alert_btn);

        initData();

        alertBtn.setOnClickListener(v -> {
            if (listener != null)
                listener.onAgreeClick();
        });
    }

    //初始化显示数据
    private void initData() {
        //这里的Html功能没有实现完
        content = context.getResources().getString(R.string.alert_content);

    }

    public interface OnClickAgreeListener {
        void onAgreeClick();
    }

}
